#ifndef		_DDS_REG_OPERATOR
#define		_DDS_REG_OPERATOR
#include "add9913_reg_define.h"

#define _REF_FREQ ((float)25.00000)

/***************************************************/
//Function:		int init_AD9913()						
//Parametre:		ddsReg_t *initReg,						
//				ddsReg_t *regStruct					
//Description:		Initialize the DDS,reset the chip, set the	
//				default register value in 'initReg'.Read the 	
//				registers and stored in 'regStruct'.		
//Return:		'1': successfully initialized the chip.   	       
//				'-1': failed to communicate with the chip.	
//				'0': other errors.						
/***************************************************/
int init_AD9913(ddsReg_t initReg, ddsReg_t *regStruct);

/***************************************************/
//Function:		int get_AllRegValue()					
//Parametre:		ddsReg_t *regStruct					
//Description:		Read the whole current register value of the
//				DDS and stored in 'regStruct'.			
//Return:		'1': successfully get the register value.		
//				'-1': failed to communicate with the chip.	
//				'0': other errors.						
/***************************************************/
int get_AllRegValue(ddsReg_t *regStruct);

/*******************************************************************************/
//Function:		int set_RegValue()															
//Parametre:		regByt_t *regByt,													
//				regBitOfs_t offsetVal,												
//				regBitVal bitVal													
//Description:		Set the bit value of the register,the element	 of this operation is the single	
//				word of the register.For example you want to set the sinewave output bit,you	
//				can call this func inthis way:											
//				set_RegValue(&(ddsRegStruct._SIN_OUT_BA),_SIN_OUT_OFS, EN_SIN_OUT);
//NOTICE:		This function only sets the value in the temp var,without writting to the DDS.	
//Return:		'1': successfully set the value.										
//				'0': failed to set the value.											
/*******************************************************************************/
int set_RegValue(regByt_t *regByt, regBitOfs_t offsetVal, regBitVal_t bitVal);

/***************************************************/
//Function:		int set_InstByte()									
//Parametre:		instConfig_t configStruct,				
//				inst_t *instByte						
//Description:		Set the instruction byte from the config 	
//				structure.								
//NOTICE:		This function only sets the value in the temp 
//				var,without writting to the DDS.				
//Return:		'1': successfully set the value.			
//				'0': failed to set the value.				
/***************************************************/
int set_InstByte(instConfig_t configStruct, inst_t *instByte);

/***************************************************/
//Function:		int get_RegValue()								
//Parametre:		regAddr_t regAddress,					
//				regByt_t *regByte						
//Description:		This function gets the specified register 	
//				value from the DDS, and stored in 'regByte'
//				which should be a regByt_t type.				
//Return:		'1': successfully getting the value.			
//				'-1':failed to communicate with the chip.	
//				'0': for other errors.					
/***************************************************/
int get_RegValue(regAddr_t regAddress, regByt_t *regByte);

/***************************************************/
//Function:		regByt_t get_BitValue()
//Parametre:		regByt_t regByte,
//				regBitOfs_t ofsAddr
//Description:		This function read the specified bit(s) in a 
//				byte 'regByte'.The value is returned in 'regByt_t'
//				type.
//Return:		The specified bit(s).
/***************************************************/
regByt_t get_BitValue(regByt_t regByte, regBitOfs_t ofsAddr);

/***************************************************/
//Parametre:		float oprtFreq,			
//				ddsReg_t *regStruct				 			
//Description:		This function sets the PLL-relate registers to
//				config the clock frequency of the DDS.
//				The frequency to be set is given by 'oprtFreq'
//				in float format.The parametre 'regStruct' is
//				the storage struct of the whole register.
//NOTICE:		This function only sets the value in the temp
//				var, without writting to the DDS.
//				The frequency given by 'oprtFreq' is in unit
//				Mega Hertz.
//				The real system frequency is an approximate
//				value to the setting frequency.
//Return:		'1': successfully setting the register.
//				'0': failed to set the register.
/****************************************************/
int set_PllPara(float oprtFreq, ddsReg_t *regStruct);

/**/
//
/**/
int set_OutputFreq(uint32_t sineFreq, ddsReg_t *regStruct);

/**/
//
/**/
int set_InitialPhase(uint16_t initialPhase, ddsReg_t *regStruct);

/**/
//
/**/
int 
#endif		//#ifndef _DDS_REG_OPERATOR
